package com.brillilab.service.module.message.template.impl.usercenter;

import com.alibaba.fastjson.JSONObject;
import com.brillilab.service.module.message.template.AbstractMessageTemplate;
import com.brillilab.service.module.message.template.enums.MessageTypeEnum;

/**
 * @author zlb
 * @Title: RemoveLabMsgTemplate
 * @ProjectName brill_lab
 * @Description: 用户被移出实验室
 * @date 2019/5/24 17:27
 */
public class RemoveLabMsgTemplate extends AbstractMessageTemplate {

    private String labName;
    private String operator;

    /**
     * 用户被移出实验室
     * @param labId       实验室ID
     * @param receiverId  接收人Id
     * @param labMemberId 接收者实验室成员Id
     * @param labName     实验室名称
     * @param operator    操作人
     */
    public RemoveLabMsgTemplate(Long labId, Long receiverId,Long labMemberId,String labName, String operator) {
        super(labId, receiverId);
        super.setType(MessageTypeEnum.RemoveLab.getValue());
        super.setTitle("您已被移出实验室");
        String content=String.format(
                "<span>你已被</span>" + "<span style='color:#F6AC2D'>%s</span>" +
                "<span>移出</span>" + "<span style='color:#F6AC2D'>%s</span>" +
                "<span>，如有疑问请联系实验室管理员</span>"
                ,operator,labName);
        super.setContent(content);
        super.setAppContent(String.format(
                "你已被%s移出%s，如有疑问请联系实验室管理员",operator,labName));
        this.labMemberId=labMemberId;
        this.labName = labName;
        this.operator = operator;
    }

    public RemoveLabMsgTemplate(Long labId, Long receiverId) {
        super(labId, receiverId);
    }

    @Override
    public String getJsonData() {
        JSONObject object=new JSONObject();
        object.put("labMemberId",labMemberId);
        object.put("labName",labName);
        object.put("operator",operator);
        object.put("content",appContent);
        return object.toJSONString();
    }

}
